package models

import (
	"math/rand"
	"time"
)

type Chats struct {
	Id         uint      `gorm:"column:id;type:bigint(22);primaryKey;not null;" json:"id"`
	ToUserId   uint      `gorm:"column:to_user_id;type:bigint(22);not null;" json:"to_user_id"`
	FormUserId uint      `gorm:"column:form_user_id;type:bigint(22);not null;" json:"form_user_id"`
	Content    string    `gorm:"column:content;type:varchar(200);not null;" json:"content"`
	CType      uint      `gorm:"column:c_type;type:bigint(22);not null;" json:"c_type"`
	RoomId     uint      `gorm:"column:room_id;type:bigint(22);not null;" json:"room_id"`
	CreatedAt  time.Time `gorm:"column:created_at;type:datetime(3);default:NULL;" json:"created_at"`
}

func (c *Chats) Room() int {

	i := rand.Intn(9000000) + 1000000
	return i
}
